/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package Estacionamento.GUI;

import Estacionamento.ClassesBasicas.Cliente;
import Estacionamento.ClassesBasicas.Endereco;
import Estacionamento.ClassesBasicas.Plano;
import Estacionamento.ClassesBasicas.Veiculo;
import Estacionamento.Negocio.Fachada;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.JOptionPane;

/**
 *
 * @author Danilo Lima
 */
public class ListarCliente1 extends javax.swing.JFrame {

    /**
     * Creates new form ListarCliente1
     */
    public ListarCliente1() {
        initComponents();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel13 = new javax.swing.JLabel();
        jLabel14 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        campoListarClienteNum = new javax.swing.JTextField();
        jLabel15 = new javax.swing.JLabel();
        jButton2 = new javax.swing.JButton();
        jLabel19 = new javax.swing.JLabel();
        jLabel10 = new javax.swing.JLabel();
        campoListarClientePlanoValor = new javax.swing.JTextField();
        jButton1 = new javax.swing.JButton();
        jLabel12 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        campoListarClienteCpf = new javax.swing.JTextField();
        campoListarClienteNome = new javax.swing.JTextField();
        campoListarClienteTel = new javax.swing.JTextField();
        campoListarClienteRua = new javax.swing.JTextField();
        campoListarClienteBairro = new javax.swing.JTextField();
        campoListarClienteCidade = new javax.swing.JTextField();
        campoListarClienteCEP = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        campoListarClienteUF = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        campoListarClienteComp = new javax.swing.JTextField();
        jLabel1 = new javax.swing.JLabel();
        campoListarClienteVeiNome = new javax.swing.JTextField();
        jLabel16 = new javax.swing.JLabel();
        campoListarClienteVeiPlacaNum = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        campoListarClienteVeiPlacaLet = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        campoListarClientePlano = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        campoListarClienteVeiMarca = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        campoListarClienteVeiTipo = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButton3 = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jLabel13.setText("Veículo");

        jLabel14.setText("Nome:");

        jLabel6.setText("Nº");

        jLabel11.setText("CEP:");

        jLabel15.setText("Marca:");

        jButton2.setText("Cancelar");
        jButton2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton2ActionPerformed(evt);
            }
        });

        jLabel19.setText("Valor:");

        jLabel10.setText("Comp:");

        campoListarClientePlanoValor.setEditable(false);

        jButton1.setText("Visualizar");
        jButton1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton1ActionPerformed(evt);
            }
        });

        jLabel12.setText("Plano:");

        jLabel3.setText("Tel:");

        jLabel2.setText("CPF:");

        jLabel7.setText("Bairro:");

        jLabel1.setText("Nome:");

        jLabel16.setText("Placa:");

        jLabel17.setText("-");

        jLabel8.setText("Cidade:");

        jLabel18.setText("Tipo:");

        jLabel9.setText("UF:");

        jLabel5.setText("Rua:");

        jLabel4.setText("Endereço");

        jButton3.setText("Excluir");
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });

        jButton4.setText("Alterar");
        jButton4.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton4ActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(jLabel7)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(campoListarClienteBairro, javax.swing.GroupLayout.PREFERRED_SIZE, 210, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel16)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoListarClienteVeiPlacaLet, javax.swing.GroupLayout.PREFERRED_SIZE, 59, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel17)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoListarClienteVeiPlacaNum, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(79, 79, 79)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel5)
                                .addGap(18, 18, 18)
                                .addComponent(campoListarClienteRua, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addComponent(jLabel13)
                            .addComponent(jLabel4)
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel14)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoListarClienteVeiNome, javax.swing.GroupLayout.PREFERRED_SIZE, 152, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel8)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoListarClienteCidade, javax.swing.GroupLayout.PREFERRED_SIZE, 211, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(layout.createSequentialGroup()
                                    .addComponent(jLabel2)
                                    .addGap(18, 18, 18)
                                    .addComponent(campoListarClienteCpf))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                        .addComponent(jLabel1)
                                        .addComponent(jLabel3))
                                    .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(campoListarClienteNome)
                                        .addComponent(campoListarClienteTel, javax.swing.GroupLayout.PREFERRED_SIZE, 123, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addComponent(jButton3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jButton4)
                        .addGap(6, 6, 6)))
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(8, 8, 8)
                        .addComponent(jLabel9)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(campoListarClienteUF, javax.swing.GroupLayout.PREFERRED_SIZE, 35, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(jLabel11)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(campoListarClienteCEP))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(jLabel18)
                                    .addComponent(jLabel15))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(campoListarClienteVeiMarca, javax.swing.GroupLayout.DEFAULT_SIZE, 102, Short.MAX_VALUE)
                                    .addComponent(campoListarClienteVeiTipo)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                                .addComponent(campoListarClienteNum, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(jLabel10)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(campoListarClienteComp, javax.swing.GroupLayout.PREFERRED_SIZE, 50, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGroup(layout.createSequentialGroup()
                            .addComponent(jButton1)
                            .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                            .addComponent(jButton2)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(jLabel19)
                            .addComponent(jLabel12))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(campoListarClientePlano)
                            .addComponent(campoListarClientePlanoValor))))
                .addGap(0, 0, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel12)
                    .addComponent(campoListarClientePlano, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2)
                    .addComponent(campoListarClienteCpf, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel1)
                        .addComponent(campoListarClienteNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel19)
                        .addComponent(campoListarClientePlanoValor, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(campoListarClienteTel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel4)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(campoListarClienteRua, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel6)
                    .addComponent(campoListarClienteNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel10)
                    .addComponent(campoListarClienteComp, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(3, 3, 3)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jLabel7)
                            .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                                .addComponent(jLabel9)
                                .addComponent(campoListarClienteUF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addComponent(campoListarClienteBairro, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel8)
                            .addComponent(campoListarClienteCidade, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(jLabel11)
                            .addComponent(campoListarClienteCEP, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jLabel13)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel14)
                            .addComponent(campoListarClienteVeiNome, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel16)
                            .addComponent(jLabel17)
                            .addComponent(campoListarClienteVeiPlacaNum, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(campoListarClienteVeiPlacaLet, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGap(72, 72, 72)
                                .addComponent(jLabel15))
                            .addComponent(campoListarClienteVeiMarca, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel18)
                            .addComponent(campoListarClienteVeiTipo, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButton1)
                    .addComponent(jButton2)
                    .addComponent(jButton3)
                    .addComponent(jButton4)))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
        // TODO add your handling code here:
        Fachada fachada = new Fachada();
        try {

            Cliente cliente = new Cliente();
            Endereco end = new Endereco();
            Veiculo vei = new Veiculo();
            Plano p =new Plano();
            p=fachada.listarPlano(campoListarClientePlano.getText());
            
            cliente = fachada.listarCliente(campoListarClienteCpf.getText());
           if(campoListarClienteCpf.getText().equals("")){
               JOptionPane.showMessageDialog(null,"Preencha o campo cpf");
           } 
           else if (cliente.getCpf()== null) {
                JOptionPane.showMessageDialog(null, "Cliente nao cadastrado");
            }
            else{
            end = cliente.getEndereco();
            vei = cliente.getVeiculo();
            p=cliente.getPlano();
            campoListarClienteNome.setText(cliente.getNome());
            campoListarClienteTel.setText(cliente.getTelefone());
            campoListarClienteComp.setText(end.getComplemento());
            campoListarClienteBairro.setText(end.getBairro());
            campoListarClienteCEP.setText(end.getCep());
            campoListarClienteRua.setText(end.getRua());
            campoListarClienteUF.setText(end.getEstado());
            campoListarClienteNum.setText(end.getNumero());
            campoListarClienteCidade.setText(end.getCidade());
            campoListarClienteVeiMarca.setText(vei.getMarca());
            campoListarClienteVeiNome.setText(vei.getNome());
            campoListarClienteVeiPlacaLet.setText(vei.getPlacaLetra());
            campoListarClienteVeiPlacaNum.setText(vei.getPlacaNum());
            campoListarClienteVeiTipo.setText(vei.getTipoVeiculo());
            campoListarClientePlano.setText(p.getTipoPlano());
            campoListarClientePlanoValor.setText(String.valueOf( p.getValorPlano()));
           }           
        } catch (Exception ex) {

        }
    }//GEN-LAST:event_jButton1ActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
            Fachada fa =new Fachada ();
            Cliente c = new Cliente();
        try {
            c=fa.listarCliente(campoListarClienteCpf.getText());
            
        } catch (Exception ex) {
            Logger.getLogger(ListarCliente1.class.getName()).log(Level.SEVERE, null, ex);
        }
            
            try {
            
            fa.excluirCliente(campoListarClienteCpf.getText());
           
            campoListarClienteCpf.setText(null);
            campoListarClienteNome.setText(null);
            campoListarClienteTel.setText(null);
            campoListarClienteComp.setText(null);
            campoListarClienteBairro.setText(null);
            campoListarClienteCEP.setText(null);
            campoListarClienteRua.setText(null);
            campoListarClienteUF.setText(null);
            campoListarClienteNum.setText(null);
            campoListarClienteCidade.setText(null);
            campoListarClienteVeiMarca.setText(null);
            campoListarClienteVeiNome.setText(null);
            campoListarClienteVeiPlacaLet.setText(null);
            campoListarClienteVeiPlacaNum.setText(null);
            campoListarClienteVeiTipo.setText(null);
            // TODO add your handling code here:
        } catch (Exception ex) {
            
        }
    }//GEN-LAST:event_jButton3ActionPerformed

    private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
        dispose();
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton2ActionPerformed

    private void jButton4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton4ActionPerformed
        // TODO add your handling code here:
        Fachada f1= new Fachada();
        Cliente c1 =new Cliente();
        Plano p = new Plano();
        try {
            p=f1.listarPlano(campoListarClientePlano.getText());
        } catch (Exception ex) {
            Logger.getLogger(ListarCliente1.class.getName()).log(Level.SEVERE, null, ex);
        }
        try {
            c1=f1.listarCliente(campoListarClienteCpf.getText());
        } catch (Exception ex) {
            Logger.getLogger(ListarCliente1.class.getName()).log(Level.SEVERE, null, ex);
        }
        if(c1.getCpf()==null ){
            JOptionPane.showMessageDialog(null, "Cliente nao cadastrado");
        }
        else if(campoListarClienteNome.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Nome é obrigatorio");
            
        }else  if(campoListarClienteCpf.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo CPF é obrigatorio");
        }else  if(campoListarClienteTel.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Telefone é obrigatorio");
        }else if(campoListarClienteRua.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Rua é obrigatorio");
        } else if(campoListarClienteNum.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Numero é obrigatorio");
        }else if(campoListarClienteComp.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Complemento é obrigatorio");
        }else  if(campoListarClienteBairro.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo bairro é obrigatorio");
        }else  if(campoListarClienteUF.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo UF é obrigatorio");
        }else  if(campoListarClienteCidade.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Cidade é obrigatorio");
        }else  if(campoListarClienteCEP.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo CEP é obrigatorio");
        }else if(campoListarClienteVeiNome.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Nome do veiculo é obrigatorio");
        } else if(campoListarClienteVeiMarca.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo marca do veiculo é obrigatorio");
        }else  if(campoListarClienteVeiPlacaLet.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Placa é obrigatorio");
        }else if(campoListarClienteVeiPlacaLet.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Placa é obrigatorio");
        }else if(campoListarClienteVeiTipo.getText().trim().equals("")){
            JOptionPane.showMessageDialog(null,"Campo Tipo do veiculo é obrigatorio");
        }else if(p.getTipoPlano()==null){
            JOptionPane.showMessageDialog(null,"Plano não cadastrado");
        }
        else {
            Fachada f =new Fachada();
            Fachada fa =new Fachada();
            Cliente c =new Cliente ();
            Endereco end =new Endereco();
            Veiculo vei=new Veiculo();
            try {
                c= f.listarCliente(campoListarClienteCpf.getText());
            } catch (Exception ex) {
                Logger.getLogger(ListarCliente1.class.getName()).log(Level.SEVERE, null, ex);
            }
            c.setCpf(campoListarClienteCpf.getText());
            c.setNome(campoListarClienteNome.getText());
            c.setTelefone(campoListarClienteTel.getText());
            end.setBairro(campoListarClienteBairro.getText());
            end.setCep(campoListarClienteCEP.getText());
            end.setCidade(campoListarClienteCidade.getText());
            end.setComplemento(campoListarClienteComp.getText());
            end.setEstado(campoListarClienteUF.getText());
            end.setNumero(campoListarClienteNum.getText());
            end.setRua(campoListarClienteRua.getText());
            c.setPlano(p);
            c.setEndereco(end);
           /* vei.setMarca(campoListarClienteVeiMarca.getText());
            vei.setNome(campoListarClienteVeiNome.getText());
            vei.setPlacaLetra(campoListarClienteVeiPlacaLet.getText());
            vei.setPlacaNum(campoListarClienteVeiPlacaNum.getText());
            vei.setTipoVeiculo(campoListarClienteVeiTipo.getText());
            c.setVeiculo(vei);*/
            try {
                fa.alterarCliente(c);
            } catch (Exception ex) {
                Logger.getLogger(ListarCliente1.class.getName()).log(Level.SEVERE, null, ex);
            }
            
        
        }
    }//GEN-LAST:event_jButton4ActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(ListarCliente1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(ListarCliente1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(ListarCliente1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(ListarCliente1.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the form */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new ListarCliente1().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JTextField campoListarClienteBairro;
    private javax.swing.JTextField campoListarClienteCEP;
    private javax.swing.JTextField campoListarClienteCidade;
    private javax.swing.JTextField campoListarClienteComp;
    private javax.swing.JTextField campoListarClienteCpf;
    private javax.swing.JTextField campoListarClienteNome;
    private javax.swing.JTextField campoListarClienteNum;
    private javax.swing.JTextField campoListarClientePlano;
    private javax.swing.JTextField campoListarClientePlanoValor;
    private javax.swing.JTextField campoListarClienteRua;
    private javax.swing.JTextField campoListarClienteTel;
    private javax.swing.JTextField campoListarClienteUF;
    private javax.swing.JTextField campoListarClienteVeiMarca;
    private javax.swing.JTextField campoListarClienteVeiNome;
    private javax.swing.JTextField campoListarClienteVeiPlacaLet;
    private javax.swing.JTextField campoListarClienteVeiPlacaNum;
    private javax.swing.JTextField campoListarClienteVeiTipo;
    private javax.swing.JButton jButton1;
    private javax.swing.JButton jButton2;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton4;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    // End of variables declaration//GEN-END:variables
}
